<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>注册 - beego</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/admin-lte/2.4.2/css/AdminLTE.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/iCheck/1.0.2/skins/flat/blue.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Google Font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

    <style>
        body.login-page .has-feedback .form-control {
            padding-left: 34px;
            padding-right: 10px;
        }
        body.login-page .form-control-feedback {
            left: 0;
        }

        .login-box input.form-control {
            height: 46px;
            padding: 10px 16px;
            line-height: 1.3333333;
        }
        .form-control-feedback {
            top: 6px;
        }
    </style>
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="#">人气阅读</a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">注册</p>

        <form action="" method="post">
            <div class="form-group has-feedback">
                <input type="text" name="username" value="" class="form-control" placeholder="手机号">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <div class="input-group">
                    <input type="text" name="captcha_img" id="captcha_img" class="form-control" placeholder="图形验证码">
                    <span class="glyphicon glyphicon-info-sign form-control-feedback" style="z-index: 999;"></span>
                    <span class="input-group-addon captcha-img" style="padding: 0;">
                        <img id="key" src="javaScript:captcha()"><input type="hidden" id="idKey">
                    </span>
                </div>
            </div>
            <div class="form-group has-feedback">
                <div class="input-group">
                    <input type="text" name="captcha" id="captcha" class="form-control" placeholder="手机验证码">
                    <span class="glyphicon glyphicon-envelope form-control-feedback" style="z-index: 999;"></span>
                    <span class="input-group-addon">
                        <button type="button" class="btn btn-link btn-block" id="get-captcha" style="padding-top: 0; padding-bottom: 0;">获取验证码</button>
                    </span>
                </div>
            </div>
            <div class="form-group has-feedback">
                <input type="password" name="password" class="form-control" placeholder="设置登陆密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" name="password_again" class="form-control" placeholder="确认登陆密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="form-group form-help-block">
                <div class="row">
                    <div class="col-xs-4">

                    </div>
                    <!-- /.col -->
                    <div class="col-xs-8 text-right">
                        已有账号？<a href="/console/login" class="text-center">立即登陆</a>
                    </div>
                    <!-- /.col -->
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <button type="submit" class="btn btn-primary btn-block btn-flat btn-lg">立即注册</button>
                </div>
                <!-- /.col -->
            </div>
        </form>

    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 3 -->
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="https://cdn.bootcss.com/iCheck/1.0.2/icheck.min.js"></script>
<script>
    $(function () {
        $('input').iCheck({
            checkboxClass: 'icheckbox_flat-blue',
            radioClass: 'iradio_flat-blue',
            increaseArea: '20%' // optional
        });
        $("#key").click(function () {
            captcha()
        })

    });
    function captcha() {
        $.ajax({
            url: '/captcha',
            type: 'get',
            async: false,//使用同步的方式,true为异步方式
            success: function (data) {
                console.log(typeof data)
                $("#key").attr("src",data.captcha)
                $("#idKey").val(data.key)
                // console.log(res)
            },
        })
    }
    captcha()
</script>
</body>
</html>